package com.glut.gultguy.controller;


import com.glut.gultguy.entity.UsersLike;
import com.glut.gultguy.service.UsersLikeService;
import com.glut.gultguy.utils.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-09-16
 */
@RestController
@RequestMapping("/usersLike")
public class UsersLikeController {
    @Autowired
    private SnowflakeIdWorker idWorker;
    @Autowired
    UsersLikeService service;

    @PostMapping("/addLike")
    public void addLike(@RequestBody UsersLike like){
        like.setId(idWorker.nextId()+"");
        service.save(like);
    }
}

